#define  _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
using namespace std;

int getLongestPalindrome(string A) {
    int left = 0;
    int right = A.size() - 1;
    int max = 1;
    while (left != right)
    {
        right = A.rfind(A[left]);
        if (left != right)
        {
            int begin = left;
            int end = right;
            int flag = 1;
            while (begin != end)
            {
                if (A[begin] != A[end])
                {
                    flag = 0;
                    break;
                }
                begin++;
                end--;
            }
            if (flag)
            {
                if (right - left > max)
                    max = right - left;
            }
        }
        left++;
    }
    return max;
}


int main10()
{
    int ret = getLongestPalindrome("ababc");

    return 0;
}